package org.barad.architecture.analyzer.model.impl;

import org.barad.architecture.analyzer.archpad.component.CloneableEntity;

/**
 * This class is the base for the model constraints.
 * User defined constraints must extend this class.
 * 
 * @author svetoslavganov@gmail.com (Svetoslav R. Ganov)
 *
 */
public class Constraint extends CloneableEntity {
	private String name;
	
	/**
	 * Creates a new instance.
	 */
	public Constraint() {
		this.name = "New Constraint";
	}

	/**
	 * Creates a new instance.
	 * 
	 * @param name The constraint name.
	 */
	public Constraint(String name) {
		this.name = name;
	}
	
	/**
	 * @see Object#toString()
	 */
	@Override 
	public String toString() {
		return name;
	}
	
	/**
	 * @see Object#clone()
	 */
	@Override
	public Object clone() {
		return new Specification(name);
	}
	
	/**
	 * Gets the constraint name.
	 * 
	 * @return The name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the constraint name.
	 * 
	 * @param name The name.
	 */
	public void setName(String name) {
		this.name = name;
	}
}
